package eoeProject.edenOfEast.page.analyses.analysesTop.component;

import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.IAjaxCallDecorator;
import org.apache.wicket.ajax.calldecorator.AjaxCallDecorator;
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.Panel;

//@AuthorizeInstantiation("ADMIN")
public class AnalysesTopSuccessPanel extends Panel {
	private static final long serialVersionUID = 1L;
	private Form<Void> form = new Form<Void>("form");

	public AnalysesTopSuccessPanel(String id) {
		super(id);

		form.add(OKButton);

		add(form);

	}

	private AjaxButton OKButton = new AjaxButton("OKButton") {
		/**
		 *
		 */
		private static final long serialVersionUID = -2942520388218435030L;

		@SuppressWarnings("rawtypes")
		@Override
		protected void onSubmit(AjaxRequestTarget target, Form form) {
			setResponsePage(new eoeProject.edenOfEast.page.analyses.analysesTop.Index());
		}

		@Override
		protected void onError(AjaxRequestTarget ajaxrequesttarget,
				Form<?> form1) {
		}

		@Override
		protected IAjaxCallDecorator getAjaxCallDecorator() {
			return new AjaxCallDecorator() {
				/**
				 *
				 */
				private static final long serialVersionUID = 1L;

				@Override
				public CharSequence decorateScript(Component c,
						CharSequence script) {
					return super.decorateScript(c, "resetlocate(); " + script);
				}

			};
		}

	};

}
